package com.zjgsu.nftplatform.util;

import org.apache.shiro.SecurityUtils;
import org.springframework.util.Assert;

/**
 * @author ahy231
 * @date 2022/3/28 14:32
 * @description
 */
public class UserIdUtil {
    public static long getUserId() {
        String token = SecurityUtils.getSubject().getPrincipal().toString();
        Long userId = JWTUtil.getUserId(token);
        Assert.notNull(userId, "service 获取不到用户 id");
        return userId;
    }
}
